package com.dearbinge.data.dao;

import com.baomidou.mybatisplus.plugins.Page;
import com.dearbinge.data.pojo.user.User;

import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.mapstruct.Mapper;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Mapper
public interface UserMapper {
    User getById(Integer id);

    Integer insert(User user);

    Integer delete(Integer id);

    Integer update(User user);

    User getByOpendId(String opendId);

    List<Map<String,Object>> getOnLineUser(@Param("seqencing") String seqencing,@Param("type") Integer type,@Param("district") String district, @Param("staAge") Integer staAge, @Param("endAge") Integer endAge, @Param("weight") String weight, @Param("stature") String stature, @Param("emotionalState") Integer emotionalState, @Param("sex") Boolean sex, @Param("minLat") Double minLat, @Param("minLng") Double minLng, @Param("maxLat") Double maxLat, @Param("maxLng") Double maxLng, @Param("longitude") Double longitude, @Param("latitude") Double latitude, @Param("page") Page page);

    Integer count(@Param("seqencing") String seqencing,@Param("type") Integer type,@Param("district") String district, @Param("staAge") Integer staAge, @Param("endAge") Integer endAge, @Param("weight") String weight, @Param("stature") String stature, @Param("emotionalState") Integer emotionalState, @Param("sex") Boolean sex, @Param("minLat") Double minLat, @Param("minLng") Double minLng, @Param("maxLat") Double maxLat, @Param("maxLng") Double maxLng, @Param("longitude") Double longitude, @Param("latitude") Double latitude);

    void updateOnLineTime(@Param("id") Integer id,@Param("date") Date date);


    /**
     * 根据用户id查询该用户上家
     * @param userId 用户id
     * @return 该用户上家
     */
    List<User> listUserByLevel(Integer userId);

    Integer bindingPhone(@Param("userId") String userId,@Param("phone") String phone);

    Integer register(@Param("userName") String userName, @Param("pwd") String pwd,@Param("name") String name);

    Integer checkout(String userName);

    Integer updateO2ByPhone(@Param("phone") String phone,@Param("o2") BigDecimal o2);

    Integer login(@Param("userName") String userName,@Param("pwd") String pwd);

}
